package service;

import dao.ActorDao;
import domin.Actor;

import util.Condition;
import util.JdbcHelper;
import util.Pagination;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;


public final class ActorService {
    private static final ActorDao actorDao = ActorDao.getInstance();
    private static final ActorService actorService = new ActorService();

    public static ActorService getInstance() {
        return actorService;
    }

    public Actor find(Integer id) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        Actor actor = actorDao.find(connection,id );
        JdbcHelper.close(connection);
        return actor;
    }
    public Collection<Actor> findAll(Collection<Condition> condition, Pagination pagination) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        Collection<Actor> actors = actorDao.findAll(connection,condition,pagination);
        JdbcHelper.close(connection);
        return actors;
    }
}


